package router

import (
	"api-gateway/basic/config"
	"api-gateway/handler/api"
	"github.com/gin-gonic/gin"
	"github.com/share309/gojwt"
)

func Router(r *gin.Engine) {
	apiGroup := r.Group("/api")
	{
		user := apiGroup.Group("/user")
		{
			user.POST("/login", api.Login) //登录
		}
		order := apiGroup.Group("/order")
		{
			order.Use(gojwt.JWTAuth(config.JWT_KEY))
			order.POST("/create", api.CreateOrder)   //创建订单
			order.POST("/pay", api.UpdateOrder)      //订单支付
			order.GET("/detail", api.GetOrderDetail) //订单详情
		}

	}
}
